//
//  Beep.h
//  HelloIphone
//
//  Created by Geoffrey Gallaway on 12/17/08.
//

#import <UIKit/UIKit.h>
#import "AudioQueueObject.h"
#import "Tone.h"

#define kSecondsPerBuffer 0.5
#define kNumberAudioDataBuffers 3

@interface Beep : AudioQueueObject {
	AudioQueueBufferRef			buffers[kNumberAudioDataBuffers];
	UInt32						bufferByteSize;
	UInt32						numPacketsToRead;
	
	Float32						gain;
	UInt32						beepLengthInSeconds;
	
	BOOL							donePlayingFile;
	BOOL							audioPlayerShouldStopImmediately;
}

@property (readwrite) UInt32		numPacketsToRead;
@property (readwrite) BOOL			donePlayingFile;
@property (readwrite) BOOL			audioPlayerShouldStopImmediately;
@property (readwrite) UInt32		bufferByteSize;
@property (readwrite) Float32		gain;

- (id) init;
- (void) setupAudioPlayback;
- (void) playTone:(Tone*)tone;
- (void) beep:(int)hz length:(float)seconds;
- (void) calculateSizesFor: (Float64) seconds;
- (void) setupPlaybackAudioQueueObject;
- (void) setupAudioQueueBuffers;
- (void)addTones: (NSArray*)newTones;
- (void)addTone: (Tone*)tone;
- (void)removeTones;
- (void)play;
- (bool)isDonePlaying;


@end
